RETURN {<expression>}
RETURN
RETURN Attr1**Sqrt(Attr2)
Sends a value from a subroutine to the logic that called the subroutine. In the same way that parameters send information from the calling logic to the subroutine, RETURN sends information from the subroutine to the calling logic. After the RETURN is executed, no more logic in the subroutine is executed. When subroutines return values, the RETURN statement must be followed by an expression.
When used in logic that is not a subroutine, RETURN functions like a very powerful BREAK or BREAKBLK statement. Whereas BREAK and BREAKBLK exit only the innermost loop or statement block, RETURN exits the logic completely, no matter how deeply nested inside loops and statement blocks.
Any logic, but used most often in user-defined subroutines.
<expression>
The value to return. This expression must be on the same line as the RETURN. If a subroutine was activated, then the return value is ignored.
The following example uses a subroutine to check the supply of items in a storage location. If the free capacity of the location is greater than 10, the user is prompted for an order quantity; otherwise no new items will be ordered. If an order is made, the order time is returned; otherwise the variable OrdTm remains unchanged. The logic for Sub1() appears in the logic window.
Process Table
Entity... |
Location... |
Operation (min)... |
Item99 |
Stores |
|
Item99 |
Shipping |
WAIT N(3.2,.2) OrdTm = Sub1() |
Routing Table
Blk |
Output... |
Destination... |
Rule... |
Move Logic... |
1 |
Item99 |
Shipping |
SEND 1 |
MOVE FOR 15 |
1
|
Item99 |
EXIT |
FIRST 1 |
|
See Also
Subroutine Editor. Also see BREAK and BREAKBLK.
© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com |